﻿#pragma once
#include "afxwin.h"

//#define WM_SOCKET2 (WM_USER+6)

// CCDialogIO_OnLine 对话框

class CCDialogIO_OnLine : public CDialogEx
{
	DECLARE_DYNAMIC(CCDialogIO_OnLine)

public:
	CCDialogIO_OnLine(CWnd* pParent = NULL);   // 标准构造函数
	virtual ~CCDialogIO_OnLine();

	// 对话框数据
	enum { IDD = IDD_DIA_IO_OnLine
	};

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	DECLARE_MESSAGE_MAP()
public:
	/*afx_msg void OnBnClickedButtonFan();*/
	//byte *text;

	//int *temp;
	afx_msg void OnClose();
	virtual BOOL OnInitDialog();
	afx_msg void OnBnClickedCheckFan();
	afx_msg void OnBnClickedCheckButtonLightStart();
	afx_msg void OnBnClickedCheckButtonLightReset();
	afx_msg void OnBnClickedCheckRedLight();
	afx_msg void OnBnClickedCheckYellowLight();
	afx_msg void OnBnClickedCheckGreenLight();
	afx_msg void OnBnClickedCheckBlueLight();
	afx_msg void OnBnClickedCheckBuzzing();
	void Refresh();
	//	CButton m_Check0_0;
	CButton m_Check_Fan;
	afx_msg void OnBnClickedCheckConveyer1();
	afx_msg void OnBnClickedCheckConveyer2();
	afx_msg void OnBnClickedCheckBlow1();
	afx_msg void OnBnClickedCheckBlow2();
	afx_msg void OnBnClickedCheckBlow3();
	afx_msg void OnBnClickedCheckBlow21();
	afx_msg void OnBnClickedCheckBlow22();
	afx_msg void OnBnClickedCheckVision1Trigger();
	afx_msg LRESULT OnSocket2(WPARAM wParam, LPARAM lParam);
	afx_msg void OnEnChangeEditUpModelBegionPos();
	afx_msg void OnEnChangeEditDownModelBegionPos();
	afx_msg void OnEnChangeEditDustWaitTime();
	afx_msg void OnEnChangeEditDustTimeBlow();
	afx_msg void OnEnChangeEditDustIntervalBlow();
	afx_msg void OnEnChangeEditWorkpiece1WaitTime();
	afx_msg void OnEnChangeEditWorkpiece1BlowContinueTime();
	afx_msg void OnEnChangeEdit();
	afx_msg void OnEnChangeEditWorkpiece2BlowContinueTime();
	afx_msg void OnEnChangeEditLimitContinueTime();
	afx_msg void OnEnChangeEditUpDistance();
	afx_msg void OnEnChangeEditDownDistance();
	afx_msg void OnEnChangeEditDownPushDistance();
	afx_msg void OnEnChangeEditContinueNgNumber();
	afx_msg void OnBnClickedCheckVision2Triggre();
	afx_msg void OnBnClickedCheckUpAlarmReset();
	afx_msg void OnBnClickedCheckDownAlarmReset();
	afx_msg void OnBnClickedCheckRotate();
	afx_msg void OnBnClickedCheckInhale();
	afx_msg void OnBnClickedCheckClamp();
	afx_msg void OnBnClickedCheckCylinder1Exchange();
	afx_msg void OnBnClickedCheckCylinder2Exchange();
	afx_msg void OnBnClickedCheckConveyer3();
	afx_msg void OnBnClickedCheckConveyer4();
	afx_msg void OnBnClickedCheckConveyer5();
	afx_msg void OnBnClickedCheckGetElec();
	afx_msg void OnBnClickedCheckGetElec2();
	afx_msg void OnBnClickedCheckGetElec3();
	afx_msg void OnBnClickedCheckGetElec4();
	afx_msg void OnBnClickedCheckGetElec5();
	afx_msg void OnBnClickedCheckBlow4();
	afx_msg void OnBnClickedCheckSelectManual();
	afx_msg void OnBnClickedCheckSelectOffline();
	afx_msg void OnBnClickedCheckStack();
	afx_msg void OnBnClickedCheckSelectBigCup();
	afx_msg void OnBnClickedCheckVisionResetFinished();
	afx_msg void OnBnClickedCheckInspectCupNumZero();
	afx_msg void OnBnClickedCheckStackCupNumZero();
	afx_msg void OnBnClickedCheckDetect1Ok();
	afx_msg void OnBnClickedCheckDetect1Ng();
	afx_msg void OnBnClickedCheckDetect2Ok();
	afx_msg void OnBnClickedCheckDetect2Ng();
	afx_msg void OnBnClickedButtonDefault();
	afx_msg void OnBnClickedButtonSaveParam();
	afx_msg void OnBnClickedButtonSend();
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	afx_msg void OnEnChangeEditDisharriveWaittime();
	afx_msg void OnEnChangeEditContinuetimeBlow();
	afx_msg void OnEnChangeEditWaittimeInhale();
	afx_msg void OnEnChangeEditContinuetimeInhale();
	afx_msg void OnEnChangeEditMotorSpeed();
	afx_msg void OnEnChangeEditNumSinglechannel();
	afx_msg void OnEnChangeEdit1to2Waittime();
	afx_msg void OnEnChangeEdit1to2Continuetime();
	afx_msg void OnEnChangeIedit2to41Waittime();
	afx_msg void OnEnChangeEdit2to41Continuetime();
	afx_msg void OnEnChangeEdit2to42Waittime();
	afx_msg void OnEnChangeEdit2to42Continuetime();
	afx_msg void OnBnClickedCheck00();
	afx_msg void OnBnClickedCheck01();
	afx_msg void OnBnClickedCheckConveyerrun();
	afx_msg void OnBnClickedCheckLightRun();
	afx_msg void OnBnClickedCheckLightReset();
	afx_msg void OnBnClickedCheckLightRed();
	afx_msg void OnBnClickedCheckLightYellow();
	afx_msg void OnBnClickedCheckLightGreen();
	afx_msg void OnBnClickedCheckLightBlue();
	afx_msg void OnBnClickedCheckBuzz();
	afx_msg void OnBnClickedCheckConveyor1run();
	afx_msg void OnBnClickedCheckConveyor2run();
	afx_msg void OnBnClickedCheckBlowDust();
	afx_msg void OnBnClickedCheckBlowStuff();
	afx_msg void OnBnClickedCheckSfOn();
	afx_msg void OnBnClickedCheckSfAlarmReset();
	afx_msg void OnBnClickedCheckUnpackInhale();
	afx_msg void OnBnClickedCheckUnpackBlow();
	afx_msg void OnBnClickedCheck1to2Blow();
	afx_msg void OnBnClickedCheck2to41Blow();
	afx_msg void OnBnClickedCheck2to42Blow();
	afx_msg void OnBnClickedCheckManual();
	afx_msg void OnBnClickedCheckCommunicate();
	afx_msg void OnBnClickedCheckVision1Ok();
	afx_msg void OnBnClickedCheckVision1Ng();
	afx_msg void OnBnClickedCheckVision2Ok();
	afx_msg void OnBnClickedCheckVision2Ng();
	afx_msg void OnEnChangeEditContinuengnum();
	afx_msg void OnEnChangeEditUnpackInhalerate();
	afx_msg void OnEnChangeEditContinueBlowtime();
	afx_msg void OnBnClickedCheckRun();
	afx_msg void OnBnClickedCheckClearBlock();
	afx_msg void OnEnChangeEditUnpackInhalerate1();
	afx_msg void OnEnChangeEditUnpackInhalerate2();
	afx_msg void OnEnChangeEditUnpackInhalerate3();

	CListBox m_ListShow2;
	void ShowPICInfo();
	void BinayToDec(char* b, int* value, int size);
	int transfer(int n);
	afx_msg void OnEnChangeEditOk2Delaytime();
	afx_msg void OnEnChangeEditOk1Delaytime();
	afx_msg void OnEnChangeEditBlockTime();
	afx_msg void OnBnClickedCheckOk();
	afx_msg void OnBnClickedCheckNg();
	afx_msg void OnBnClickedCheckManual2();
	afx_msg void OnBnClickedCheckOk2();
	afx_msg void OnBnClickedCheckClearBlock2();
	afx_msg void OnBnClickedCheckOk3();
	afx_msg void OnBnClickedCheckOk4();
	afx_msg void OnBnClickedCheckOk5();
	afx_msg void OnBnClickedCheckNg2();
	afx_msg void OnEnChangeEdit1();
	afx_msg void OnEnChangeEdit2();
	afx_msg void OnEnChangeEdit3();
	afx_msg void OnEnChangeEdit4();
	afx_msg void OnEnChangeEdit10();
	afx_msg void OnEnChangeEdit11();
	afx_msg void OnEnChangeEdit12();
	afx_msg void OnEnChangeEdit5();
	afx_msg void OnEnChangeEdit14();
	afx_msg void OnEnChangeEdit15();

	bool ReadConfingIO(CCDialogIO_OnLine* a);
	int speedMotor, speedUnpack, spaceUnpack;
	afx_msg void OnEnChangeEdit567();
	afx_msg void OnEnChangeEdit16();
	afx_msg void OnEnChangePackokDelayblowtime();
	afx_msg void OnEnChangePackokBlowtime();
	afx_msg void OnEnChangeEditPackokblowtime();
	afx_msg void OnEnChangeRow();
	afx_msg void OnEnChangeOkpushDelaytime();
	afx_msg void OnEnChangePackinhaleDelaytime();
	afx_msg void OnEnChangePackinhaleContinuetime();
	afx_msg void OnEnChangePackpushDelaytime();
	afx_msg void OnEnChangePackpushCylinderspreadtime();
	afx_msg void OnEnChangespare1();
	afx_msg void OnEnChangespare2();
	afx_msg void OnEnChangePackinhaleContinuetime2();
	afx_msg void OnEnChangenewspare1();
	afx_msg void OnEnChangenewspare2();
	afx_msg void OnEnChangenewspare3();
	afx_msg void OnEnChangenewspare4();
	afx_msg void OnEnChangenewspare5();
	afx_msg void OnEnChangenewspare6();
	afx_msg void OnEnChangespare11();
	afx_msg void OnEnChangespare22();
	afx_msg void OnEnChangespare33();
	//	afx_msg void OnEnChangespare44();
	afx_msg void OnEnChangespare55();
	afx_msg void OnEnChangespare66();

	afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
	CFont font, fontUser;
	CRect m_rect[20];
	CRect m_rectStatic[20];
	CRect m_rectEdit[20];
	void UpdateUI(bool flag);
	afx_msg void OnBnClickedCheck1();
	afx_msg void OnBnClickedCheck2();
	afx_msg void OnEnChangespare77();
	afx_msg void OnEnChangespare88();
	afx_msg void OnEnChangespare99();
	afx_msg void OnBnClickedCheck3();
	afx_msg void OnEnChangespare44();
public:
	void int2bytes(int i, byte* bytes, int pos);
	void int2bytesNormal(int i, byte* bytes, int pos);
	BYTE power(BYTE num1, BYTE num2);
	int bytesToInt3(byte* src, int offset);

	int power(int a, int b);
	void  intToByte(int i, byte* bytes, int size = 4);
};
